home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Animation
/
Animation Vol.1 (Profi ROM)(1994).iso
/
pvquan15
/
pvquan.doc
< prev
next >
Wrap
Text File
|
1992-04-05
|
30KB
|
696 lines
PVQUANT Version 1.50
A Colour Quantiser
for the
Persistence of Vision Raytracer
Written and Distributed by:
Frank van der Hulst,
101 Epuni St,
Lower Hutt,
New Zealand
Electronic mail to:
UseNet: frank@cit.ac.nz, frank@whare.cavebbs.gen.nz
FidoNet: frank vanderhulst at GenBoard (Node 3:771/160)
03 April 1992
───────────────────────────────────────────────────────────────────────────
These programs are freely distributable. The authors retain the
copyright to the program but authorizes free distribution by BBS'es,
networks, magnetic media, etc. The distributor may charge no more than
five dollars ($5) U.S. for this software.
The images and data files generated by these programs are the property
of the user of the software and may be used for any purpose without
restriction.
The authors make no guarantees or warranties with these programs and
claim no responsibility for any damage or loss of time caused by this
program. Bug reports may be sent to the authors but the authors are
under no obligation to provide bug fixes, features, or any support for
this software.
The following conditions are placed on the use of this program:
1) That it should not be used as part of any commercial package without
the explicit written consent of the author.
2) If you make any changes to the source code, please let me know.
That's the way this program was built!
3) This text file must accompany the program.
This manual is divided into the following sections:
1) Archive Description
2) Background
3) Getting Started
4) Command Line Parameters
5) Output File Format
6) Source Code Information
7) Displaying the Images
8) Animation
9) Compiling the Code
10) Porting to Different Platforms
1) Archive Description
~~~~~~~~~~~~~~~~~~~~~~
This archive contains C source code for a set of programs to convert
image files produced by DKB-Trace or Persistence of Vision raytracer
into a format suitable for display on a VGA screen, or to GIF format. It
includes programs to generate a single stereoscopic 3D image from two
views of a scene, as well as programs to produce animation from multiple
ray-traced images.
The programs (or large parts of them) were written by several different
people. All of the programs are in the public domain to some extent,
with some restrictions put on them by their respective authors. I have
collected these from various places, ported them to Turbo-C and GNU C if
necessary, and formatted them in a way that I like. The copyright for
each program still belongs to its author -- my copyright claim extends
only to the collection of programs (like the editor of a journal, for
example).
QUANT (HECKBERT & OCTREE):
Colour quantisation program which post-processes raw image files
produced by the Persistence of Vision Ray Tracer (PoV Ray). Two
versions can be compiled: one uses Heckbert's median-splitting
algorithm, whereas the other uses Octree quantisation.
DISPLAY:
Displays either 320x400 or 320x200 images, either 2D, or stereo 3D. 3D
images require Sega 3D-glasses to be connected to the serial port for
viewing.
MAKEANIM:
Reads an animation source file (*.ANM), and uses it to generate data
files for the PoV ray tracer.
ANIMGIF:
Produces a .GIF file containing a series of images to be displayed by
ANIM.
ANIMFLI:
Produces a .FLI file containing a series of images to be displayed by
a .FLI player (e.g. Autodesk's AAPLAY).
ANIM:
Produces animation on a 320*200 screen using page flipping, including
sound.
Files contained in this archive:
-------------------------------
QUANT.ZIP Quantiser source code
PAC_BASE.DAT Sample PoVRay data file for generating animation
SHAPES.DAT Required to produce sample animation image
MAZE.IFF Required to produce sample animation image
INCLUDE.ZIP To be unzipped to C include directory
VGA.ZIP VGA 320x200x256x4 & 320x400x256x2 driver source code
GIFLIB.ZIP GIF encoding/decoding
ANIM.SH Unix shell script for generating animation
TRACE.SH Unix shell script to run ANIM.SH as background task
PACMAN.ANM Sample animation script
ANIM.ZIP Animation source code
QUANT.DOC Documentation
README This file
FLILIB.ZIP FLI creation routines
2) Background
~~~~~~~~~~~~~
I have a 286 PC clone with a VGA screen, and am interested in virtual
reality. I realise that a 286 doesn't have the horsepower to be good for
that, but that's all I got. Attached to this I have a pair of Sega 3D
glasses, which allows me to view see a 3D image by displaying
stereoscopic pairs of images on the screen.
I started off drawing images with Turbo C, but that was time-consuming
and not very effective. I then got a copy of DBW_RENDER and used it
(over many nights over many weeks) to produce images. In the meantime,
Craig Kolb had sent me a copy of his COLORQUANT code, which I ported to
Turbo C. I also found code to display images in 320x400 mode on my VGA.
Finally I could display some good images. I modified the quantiser to
read two input files to produce one palette, so that I could display a
3D image.
The primitives available in DBW_RENDER were very limited, so I switched
to DKB-TRACE v2.12. And ran my machine day and night for months.
Then I got access to a 486 running SCO Unix. Great! My 286 took a rest
at nights, because I could generate the most complex scenes in only a
few hours. Unfortunately, I couldn't display the images, or even move
them easily from the 486 (the only direct interchange medium is 360K
floppies, and the QRT-format files are too big). Also working with the
QRT-format was clumsy, so I converted the quantiser to read raw format
files (each of which is only 128K long, thus easily transported). Then I
saw a copy of the Octree quantisation code on UseNet, so I tried that.
It was much faster (a real advantage on the PC) but produced inferior
results. Next step was to move the quantiser to Unix, and suddenly the
Heckbert technique was best.
The extra speed of the Unix box opened up some new possibilities -- I
started to look at animation. I could generate about seven images per
hour, then use a display program to flip them up one by one. That works
fine (although it needs a lot of memory on the PC).
Then I received an assembler source file by K. Heidenstrom which did
page flipping in 320*200*256 mode. This makes animation easier, since
each image requires less memory. It also makes 3D animation possible.
Now I have easier access to a Sun IPC workstation than the the '486 --
so I've ported the raytracer and other files to compile using the GNU C
compiler gcc.
The GIF display program needs lots of memory, and the files (even after
GIF compression) are huge... the GIF standard isn't well suited to
animation. So I took the FLILIB source from Simtel... that was designed
to be compiled on the PC using TurboC (included was 8086 assembler
source code to open and close files, amongst other things). I ported
that to gcc, converting things back to C and fixing some annoying
pointer addressing problems.
Next is Floyd-Steinberg dithering, to remove unwanted "banding" of
coloured regions (called false contours).
Or maybe adding sound to a FLI player. Or perhaps 3d animation....
3) Getting Started
~~~~~~~~~~~~~~~~~~
Before quantising an image, you must create one! Use either DKB-TRACE or
PoVRAY to produce output in the "Targa" format.
I use the following command line:
PVRAY -ipacman.dat -opacman.tga -w320 -h400 -v +ft +p +x -a
See the raytracer documentation on what all the above mean. Most
important is the "+ft" option which tells the raytracer to produce
"Targa" files. The quantiser can also read "raw" format files (use the
"+fr" switch). If you use this (there's no real reason why you should)
and run PVRAY on a PC, you'll probably need to rename the files
produced. By default it